Skip to content

chore: remove unused imports and dead ui plumbing - #50

Merged
mangit955 merged 1 commit into
mainfrom
chore/prune-dead-code
Aug 4, 2026
Merged

chore: remove unused imports and dead ui plumbing#50
mangit955 merged 1 commit into
mainfrom
chore/prune-dead-code

Conversation

@mangit955

Copy link
Copy Markdown
Owner

Why

tsconfig.json sets noUnusedLocals and noUnusedParameters to false, and
verify.ts has no rule for unused imports. Nothing in the gate has ever
complained about dead code, so it accumulated quietly.

Running tsc --noEmit --noUnusedLocals --noUnusedParameters as a one-off probe
surfaced ~70 hits. Most are parameters that exist for interface conformance and
should stay. This PR removes the minority that are genuinely dead — including
startup work that looks like it feeds the UI and does not.

What

Removed Why it was dead
runtime/loop.ts — the whole toolEffects import classifyCommand, commandOf and toolEffect all imported, none read. turnState.ts, planMode.ts and executionLog.ts genuinely use them and are untouched.
tools/runTests.ts, tools/terminal.ts — the UI store import Never referenced. A tool reaching into the TUI store is also the wrong direction architecturally.
useBootAnimationLOGO, logoText state setLogoText was never called, so logoText was permanently "". BootScreen destructured it and hardcodes the word it actually renders.
HomeScreenData.repository, .provider Neither is rendered anywhere. .provider existed only to hold a getModelDisplayName() result that was discarded; app.tsx already derives the model name from the store. Dropping it lets buildHomeScreen() shed a parameter.
isThinking render chain (6 sites) Threaded from app.tsx through ConversationViewport into Timeline and read at none of them.
ReactNode, Text, colors, React, chalk, 8 test imports Unused.
3 comments An eslint-disable directive in a repo with no ESLint config, and restatement-only JSDoc in config/paths.ts (/** Get the path to models.json */).

UIState.isThinking and the store logic that maintains it stay
ui-store.test.ts asserts on them. Only the rendering plumbing is gone.

The long "why" comments throughout providers/ and runtime/ are documentation,
not noise, and were deliberately left alone. So were the // ─── … ─── section
banners.

One trap worth recording

getConfigDir() is not a pure getter — it mkdirSyncs the directory. Dropping
the unused configDir local in initializeConfig() is only safe because the
next line calls getProvidersConfigPath(), which calls getConfigDir() again.

Deliberately left in

Two more dead props turned up: CommandPreview.query and Prompt.providerName
are declared and actively passed by callers, but never read. Removing them means
editing prop interfaces plus every call site — a wider change than this one is
scoped to, so they are left for a follow-up.

Also left: TurnFooter.endedAt looked dead in the probe but is load-bearing
(TurnFooter.tsx:67,72). Only a redundant re-destructure inside TurnFooterRow
was removed.

Verified

Baseline captured on the clean tree before any edit, so there is something to
compare against:

bunx --no-install tsc --noEmit  → exit 0
bun test                        → 1409 pass, 0 fail, 91 files

After the change:

bun run verify         → docs surface ok · type check ok · tests ok — 3 gates passed
                         (22 changed files; re-run by the pre-commit hook, passed again)
bun run verify --all   → docs lint ok · docs surface ok · type check ok · tests ok — 4 gates passed
bun test               → 1409 pass, 0 fail, 91 files

Same test count as the baseline. The expect() call total does drift between
runs (18194 and 18176 on an identical tree) — that is fast-check's random
seeding, confirmed by running the suite twice without changes, not a regression.

Re-running the probe that found all this leaves only the intentional callback
parameters and the two props noted above — no import or module-level binding
remains flagged.

Not run: bun run start. The boot animation and home screen changes are
type-checked and covered by the existing TUI render tests, but nobody has
watched the app boot with these edits in place. Worth a look before this leaves
draft.

🤖 Generated with Claude Code

tsconfig sets noUnusedLocals and noUnusedParameters to false and verify.ts
has no rule for unused imports, so nothing in the gate ever complains about
dead code. Running tsc with both flags as a one-off probe surfaced ~70 hits;
this removes the ones that are genuinely dead rather than the parameters that
exist for interface conformance.

The load-bearing ones: runtime/loop.ts imported classifyCommand, commandOf
and toolEffect and read none of them; two tools imported the TUI store they
never touch, which is also the wrong direction architecturally.
useBootAnimation carried a logoText state whose setter was never called, so
it was permanently the empty string while BootScreen hardcoded the word it
actually renders. HomeScreenData.provider existed only to hold the result of
a getModelDisplayName() call that nothing rendered — app.tsx already derives
the model name from the store — and removing it lets buildHomeScreen drop a
parameter. isThinking was threaded from app.tsx through ConversationViewport
into Timeline and read at none of them; the store field and the tests that
assert on it are untouched, only the render plumbing is gone.

Comments were left alone except for three cases that document nothing: an
eslint-disable directive in a repo with no ESLint config, and restatement-only
JSDoc in config/paths.ts ("Get the path to models.json"). The long "why"
comments throughout providers/ and runtime/ are documentation and stay.

One trap worth recording: getConfigDir() is not a pure getter, it mkdirSyncs
the directory. Dropping the unused configDir local in initializeConfig() is
only safe because the next line calls getProvidersConfigPath(), which calls
getConfigDir() again.

Two dead props were found and deliberately left: CommandPreview.query and
Prompt.providerName are declared and passed by callers but never read.
Removing them means editing prop interfaces plus call sites, which is a wider
change than this one is scoped to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
woop-code Ready Ready Preview Aug 4, 2026 6:07pm

@mangit955
mangit955 marked this pull request as ready for review August 4, 2026 18:09
@mangit955
mangit955 merged commit 0eee48b into main Aug 4, 2026
6 checks passed
@mangit955
mangit955 deleted the chore/prune-dead-code branch August 4, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant